//
//  BaseCreatViewController.m
//  wulihan
//
//  Created by tang on 16/3/25.
//  Copyright © 2016年 tang. All rights reserved.
//

#import "BaseCreatViewController.h"
#import "Header.h"

#import "TitleTableView.h"
#import "LOadImageView.h"
#import "BiliView.h"


#define buttonPX            WithView/3.0
#define NOxuanzhongcolor      uicolor(21, 21, 21)


@interface BaseCreatViewController ()<TitleTableViewDelegate, BiliViewDelegate>
{
    UIButton *biliButton;
    UIButton *kuangButton;
    UIButton *colorButton;
}


@property (nonatomic, strong) TitleTableView *mainTableView;

@property (nonatomic, strong) LOadImageView *loadImageView;
@property (nonatomic, strong) BiliView *changeBiLiView;


@end

@implementation BaseCreatViewController



- (void)loadView
{
    [super loadView];
    
    [self.view setBackgroundColor:uicolor(35, 35, 35)];
    
    
    _loadImageView = [[LOadImageView alloc] initWithFrame:CGRectMake(0, 60.0, WithView, heightView-143.0-60)];
    [self.view addSubview:_loadImageView];

    
    
    _mainTableView = [[TitleTableView alloc] initWithFrame:CGRectMake(0, 0, WithView, 60)];
//    [_mainTableView setBackgroundColor:[UIColor clearColor]];
    [_mainTableView setMTitleTableViewDelegate:self];
    [self.view addSubview:_mainTableView];
    
    
    
    biliButton = [[UIButton alloc] initWithFrame:CGRectMake(0, heightView-46, buttonPX, 46)];
    [self.view addSubview:biliButton];
    
    kuangButton = [[UIButton alloc] initWithFrame:CGRectMake(buttonPX, heightView-46, buttonPX, 46)];
    [self.view addSubview:kuangButton];

    colorButton = [[UIButton alloc] initWithFrame:CGRectMake(2*buttonPX, heightView-46, buttonPX, 46)];
    [self.view addSubview:colorButton];

    
    _changeBiLiView = [[BiliView alloc] initWithFrame:CGRectMake(0, heightView-143.0, WithView, 93.0)];
    [_changeBiLiView setMBiliViewDelegate:self];
    [self.view addSubview:_changeBiLiView];

}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [biliButton setBackgroundColor:uicolor(35, 35, 35)];
    [kuangButton setBackgroundColor:NOxuanzhongcolor];
    [colorButton setBackgroundColor:NOxuanzhongcolor];
    
    [biliButton.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    [biliButton setTitle:@"照片比例" forState:UIControlStateNormal];
    
    [kuangButton.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    [kuangButton setTitle:@"气泡" forState:UIControlStateNormal];
    
    [colorButton.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    [colorButton setTitle:@"文本样式" forState:UIControlStateNormal];
    
    
    [biliButton setTag:1];
    [kuangButton setTag:2];
    [colorButton setTag:3];
    
    
    [biliButton addTarget:self action:@selector(changeEdite:) forControlEvents:UIControlEventTouchUpInside];
    [kuangButton addTarget:self action:@selector(changeEdite:) forControlEvents:UIControlEventTouchUpInside];
    [colorButton addTarget:self action:@selector(changeEdite:) forControlEvents:UIControlEventTouchUpInside];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



- (void)popToView
{
    [self.navigationController popViewControllerAnimated:YES];
}




- (void)wanchengBuoont
{
    NSLog(@"2232222");
}



- (void)buttonReload
{
    [biliButton setBackgroundColor:NOxuanzhongcolor];
    [kuangButton setBackgroundColor:NOxuanzhongcolor];
    [colorButton setBackgroundColor:NOxuanzhongcolor];

}


//编辑照片
- (void)changeEdite:(UIButton *)sender
{
    [self buttonReload];
    if (sender.tag == 1)
    {
        
        [biliButton setBackgroundColor:uicolor(35, 35, 35)];
    }
    else if (sender.tag == 2)
    {
        [kuangButton setBackgroundColor:uicolor(35, 35, 35)];
    }
    else if (sender.tag == 3)
    {
        [colorButton setBackgroundColor:uicolor(35, 35, 35)];
    }
}






//选择比例
- (void)chooseBiLi:(int)selectIndex
{
    NSLog(@"%d", selectIndex);
    [_loadImageView setCroperInt:selectIndex];
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
